﻿using System;
using System.Collections.Generic;
using Gameplay.PVE.Effect;
using TMPro;
using UnityEngine;
using Yoozoo.Framework.Core;
using Yoozoo.Managers.ResourceManagerV2.Runtime;

namespace Gameplay.PVE.Survivor
{
    /// <summary>
    /// 战斗中的hud对象
    /// </summary>
    public class BattleHudObject : BattleGameObject
    {
        public Canvas canvas;
        public Animation animation;
        public void Play()
        {
            if (IsReady)
            {
                animation.Play();
            }
        }

        protected override void OnGameObjectCreatedInternal(GameObject gameObject)
        {
            canvas = gameObject.GetComponentInChildren<Canvas>();
            animation = gameObject.GetComponentInChildren<Animation>();
            BattleResourceManager.Instance.ApplyUIOverlayMaterial(gameObject.transform);
        }

        protected override void OnGameObjectReadyInternal(GameObject gameObject)
        {
            canvas.worldCamera = CameraManager.Instance.HudCamera;
            Play();
        }
        
        protected override void OnGameObjectReleaseInternal()
        {
            
        }

        protected override void OnGameObjectDestroyInternal()
        {

        }

    
    }
}
